package com.code.man.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author 167786
 * @date 2019/9/25 19:03
 */
public class PropertiesUtils {
    public synchronized static Properties loadProps(String filePath) {
        System.out.println("开始加载properties文件内容.......");
        Properties props = new Properties();
        InputStream in = null;
        try {
            in = new FileInputStream(filePath);
            props.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                if (null != in) {
                    in.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        System.out.println("加载properties文件内容完成...........");
        System.out.println("properties文件内容：" + props);
        return props;
    }
}
